package pers.mihao.quickstream.common.model.result;

import java.io.Serializable;

public class ResultCode implements Serializable {
    private static final long serialVersionUID = 6691024803159883180L;
    public static final ResultCode SUCCESS = new ResultCode("success", "成功");
    public static final ResultCode SYSTEM_ERROR = new ResultCode("system_error", "系统错误");
    public static final ResultCode PARAMS_ERROR = new ResultCode("params_error", "参数错误");
    private String code;
    private String message;

    public ResultCode() {
    }

    public ResultCode(int code, String message) {
        this.code = String.valueOf(code);
        this.message = message;
    }

    public ResultCode(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public void setCode(int code) {
        this.code = String.valueOf(code);
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getCode() {
        return this.code;
    }

    public int getIntCode() {
        try {
            return this.code != null ? Integer.parseInt(this.code) : -1;
        } catch (NumberFormatException var2) {
            return -1;
        }
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getMessage() {
        return this.message;
    }

    public String toString() {
        return String.format("code:%s, message:%s", this.code, this.message);
    }
}
